/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.wins.vertx.entity;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;

/**
 * Converter for {@link io.wins.vertx.entity.Role}.
 *
 * NOTE: This class has been automatically generated from the {@link io.wins.vertx.entity.Role} original class using Vert.x codegen.
 */
public class RoleConverter {

  public static void fromJson(JsonObject json, Role obj) {
    if (json.getValue("createdBy") instanceof String) {
      obj.setCreatedBy((String)json.getValue("createdBy"));
    }
    if (json.getValue("createdOn") instanceof String) {
      obj.setCreatedOn((String)json.getValue("createdOn"));
    }
    if (json.getValue("description") instanceof String) {
      obj.setDescription((String)json.getValue("description"));
    }
    if (json.getValue("id") instanceof String) {
      obj.setId((String)json.getValue("id"));
    }
    if (json.getValue("roleName") instanceof String) {
      obj.setRoleName((String)json.getValue("roleName"));
    }
    if (json.getValue("updatedBy") instanceof String) {
      obj.setUpdatedBy((String)json.getValue("updatedBy"));
    }
    if (json.getValue("updatedOn") instanceof String) {
      obj.setUpdatedOn((String)json.getValue("updatedOn"));
    }
  }

  public static void toJson(Role obj, JsonObject json) {
    if (obj.getCreatedBy() != null) {
      json.put("createdBy", obj.getCreatedBy());
    }
    if (obj.getCreatedOn() != null) {
      json.put("createdOn", obj.getCreatedOn());
    }
    if (obj.getDescription() != null) {
      json.put("description", obj.getDescription());
    }
    if (obj.getId() != null) {
      json.put("id", obj.getId());
    }
    if (obj.getRoleName() != null) {
      json.put("roleName", obj.getRoleName());
    }
    if (obj.getUpdatedBy() != null) {
      json.put("updatedBy", obj.getUpdatedBy());
    }
    if (obj.getUpdatedOn() != null) {
      json.put("updatedOn", obj.getUpdatedOn());
    }
  }
}